using System.ComponentModel;
using System.Drawing;
using ClickOnceMaster.Properties;

namespace ClickOnceMaster.Common
{
    public class ManifestOperation : INotifyPropertyChanged
    {
        #region Instance fileds

		private Image _state;

        #endregion

        #region Instance properties

        /// <summary>
        /// Gets or sets the operation name.
        /// </summary>
        public string OperationName
        {
            get;
            set;
        }

    	/// <summary>
		/// Get the operation state.
		/// </summary>
		public Image State
    	{
    		get
    		{
				if (_state == null)
				{
					_state = new Bitmap(16, 16);
				}
    			return _state;
    		}
    		private set
    		{
				if (_state != value)
				{
					_state = value;
					RaisePropertyChanged(new PropertyChangedEventArgs("State"));
				}
    		}
    	}

    	#endregion

        #region .ctors

        /// <summary>
        /// Creates the instance of <see cref="ManifestOperation"/>.
        /// </summary>
        /// <param name="operationName">Operation name.</param>
        public ManifestOperation(string operationName)
        {
            OperationName = operationName;
        }

        #endregion

        #region Instance methods

        public void Complit()
        {
        	State = Resources.tick;
        }

		public void Start()
		{
			State = Resources.arrow;
		}

        #endregion

        #region Implementation of INotifyPropertyChanged

        public event PropertyChangedEventHandler PropertyChanged;

        private void RaisePropertyChanged(PropertyChangedEventArgs e)
        {
            PropertyChangedEventHandler changed = PropertyChanged;
            if (changed != null) changed(this, e);
        }

        #endregion
    }
}